import java.util.Scanner;

//数字统计
public class Main2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int l = in.nextInt(),r = in.nextInt();
        int ret =0;
        for(int i= l; i<=r; i++){
            int tmp = i;
            while(tmp != 0){
                if( tmp % 10 == 2){
                    ret++;

                }
                tmp /= 10;

            }

        }
        System.out.println(ret);
    }
}